# 数值型列表，range()生成的数字列表
for value in range(1, 5):
    print(value)

# 要创建数字列表，可使用函数list() 将range() 的结果直接转换为列表。
print(range(1, 6))

numbers = list(range(1, 6))
print(numbers)

# range指定步长
even_numbers = list(range(2, 11, 2))
# [2, 4, 6, 8, 10]
print(even_numbers)
print("\n")

squares = []
for value in range(1, 11):
    square = value**2
    squares.append(square)
print(squares)

# 列表计算
digits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
min = min(digits)
print("\nmin:")
print(min)

max = max(digits)
print("\nmax:")
print(max)

sum = sum(digits)
print("\nsum:")
print(sum)

# 列表解析，列表解析让你只需编写一行代码就能生成这样的列表

# squares = []
# for value in range(1,11):
#     square = value**2
#     squares.append(square)
# print(squares)

squares = [value**2 for value in range(1, 11)]
print(squares)
